import request from '@/utils/request'

export function loginByUsername(username, password) {
  const data = {
    username,
    password
  }
  data[`verifyCode`] = 1
  return request({
    url: '/system/users/login',
    method: 'post',
    // headers: {
    //   "Content-Type": "multipart/form-data"
    // },
    // transformRequest: [
    //   function(data) {
    //     const params = new FormData();
    //     params.append("username", data.username);
    //     params.append("password", data.password);
    //     return params;
    //   }
    // ],
    data
  })
}

export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}

export function getUserInfo(token) {
  return request({
    url: '/system/users/detail',
    method: 'get'
  })
}
